$(function () {
  var phone = getCookie("lgc");
  console.log(phone);

  if (phone) {
    $(".login").text(`您好,${phone}`);
  } else if (!phone) {
    $(".login").click(function () {
      $(location).attr("href", "../html/login.html")

    })
  }

  $('.back').css(phone ? { 'display': 'block' } : { 'display': 'none' }).click(function exit () {
    delCookie("lgc");
    location.reload();
  });

  $(".registered").click(function () {
    $(location).attr("href", "register.html");
  }).css(phone ? { 'display': 'none' } : { 'display': 'block' });


  $(".button").click(function () {
    $(location).attr("href", "goods.html");
    key = searchCon.value.trim();
    loadGrade();
    console.log(key);
  })

  $(".cart").click(function () {
    $(location).attr("href", "../html/cart.html")
  })

  $(".smallHeaderOen").click(function () {
    $(location).attr("href", "../html/indexOne.html")
  })
})